package com.job.liushuang.HomeWork0715;

import java.util.Scanner;

/**
 * @author Liushuang
 * @version 1.0
 * @since 2022-07-15 20:33:42
 */
public class Palindrome {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字：");
        int n = sc.nextInt();
        int count =0;//记录回文个数；
        int[] m=new int[6];
        for (int i = 10000; i < 999999; i++) {
            int j=0;
            int x=i;
            int sum=0;
            while (x!=0) {//将数字存入数组
                m[j]=x%10;
                x/=10;
                j++;
            }
            for (int k = 0; k <j; k++) {//求和
                sum+=m[k];
            }
            int t=0;
            for (int k = 0; k <j/2; k++) {//第一位和最后一位的比较
                if (m[k]==m[j-k-1]) {
                    t++;
                }
            }
            if (t==j/2 && sum==n) {
                System.out.println(i);
            }
            else {
                count++;
            }
        }
        if (count==1000000-10000) {//如果和不是n也不是回文数则输出fasle
            System.out.println("false");
        }
    }
}

